package com.lmiot.xyclick.Util;

import android.app.KeyguardManager;
import android.content.Context;
import android.os.PowerManager;
import com.zhy.http.okhttp.OkHttpUtils;

public class WakeUpUtil {
    public static void wakeUpAndUnlock(Context context) {
        PowerManager powerManager = (PowerManager) context.getSystemService("power");
        if (!powerManager.isScreenOn()) {
            PowerManager.WakeLock newWakeLock = powerManager.newWakeLock(268435466, "bright");
            newWakeLock.acquire(OkHttpUtils.DEFAULT_MILLISECONDS);
            newWakeLock.release();
        }
        KeyguardManager.KeyguardLock newKeyguardLock = ((KeyguardManager) context.getSystemService("keyguard")).newKeyguardLock("unLock");
        newKeyguardLock.reenableKeyguard();
        newKeyguardLock.disableKeyguard();
    }
}
